#!/usr/bin/env python
# -*- coding: utf8 -*-

'''
Created on 2011-8-2

@author: zhongfeng
'''

from icson.icsonpageparser import IcsonAllSortParser,IcsonSort3PageParser,IcsonSort4PageParser
from pageparser import ObuyUrlSummary
from spider import ObuySpider

if __name__ == '__main__':

    parserDict = {0:IcsonAllSortParser,3:IcsonSort3PageParser,4:IcsonSort4PageParser}
    
    sort3 = ObuyUrlSummary(url = r'http://category.dangdang.com/list?cat=4002134&store=eq0',name='dangdang',  
                                 isRecursed = True,catagoryLevel = 3)
    
    digitRoot = ObuyUrlSummary(url = r'http://www.newegg.com.cn/SubCategory/1046-3.htm?pageSize=96', 
                               name='digital',catagoryLevel = 4)
    
    
    #spider = ObuySpider(rootUrlSummary = sort3,parserDict = parserDict,include =None,exclude = None,threadNum = 10)
    
    #spider.spide()
    
    IcsonRoot = ObuyUrlSummary(url = r'http://category.dangdang.com/',name='dangdang',  
                                 isRecursed = True,catagoryLevel = 0)

    pserver  = ObuyUrlSummary(url = r'http://category.dangdang.com/list?cat=4001976', 
                               name='奶粉',catagoryLevel = 2)
    
    spider = ObuySpider(rootUrlSummary = IcsonRoot,parserDict = parserDict,include =None,exclude = None,threadNum = 10)
    spider.spide()